package com.ruoyi.system.api.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ruoyi.common.core.web.domain.BaseEntity;

/**
 * @author breeze
 * @date 2022.8.4
 */
public class SysFile extends BaseEntity {

	private static final long serialVersionUID = 1L;

	/** 主键 */
	@TableId(value = "file_id", type = IdType.AUTO)
	private Long fileId;

	/** 文件名称 */
	private String name;

	/** 文件存储方式 */
	private String protocol;

	/** 文件路径 */
	private String path;
	
	private Long length;
	
	@TableField(exist = false)
	private String url;
	@TableField(exist = false)
	private String previewUrl;
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
		this.setPreviewUrl(url.replace("/download/", "/inline/"));
	}

	public Long getFileId() {
		return fileId;
	}

	public void setFileId(Long fileId) {
		this.fileId = fileId;
	}

	public String getProtocol() {
		return protocol;
	}

	public void setProtocol(String protocol) {
		this.protocol = protocol;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public Long getLength() {
		return length;
	}

	public void setLength(Long length) {
		this.length = length;
	}

	public String getPreviewUrl() {
		return previewUrl;
	}

	public void setPreviewUrl(String previewUrl) {
		this.previewUrl = previewUrl;
	}
}
